<?php
/**
 * RUBIK IT Solution & Development ltd.
 *
 * PROJECT		: Rubik Ultimate
 * @version 	: 1.1
 * COPYRIGHT	: 2008
 * ------------------------------------------------------
 * 
 * [GENERAL INFO OF THIS FILE] 
 *
 * @author			hoadn <hoadn@rubik.com.vn>
 * @access			[public/private]
 * @package		 [package name]
 *
 * Created on	:Sep 19, 2008
 */

// no direct access
defined ( '_FW_EXEC' ) or die ( 'Restricted access' );

RCoreImporter::cls('html.fieldInfo.AbstractHtmlFieldInfo');

class BasicHtmlFieldInfo extends AbstractHtmlFieldInfo {

	var $_isReadOnly = false;
	var $_isContentOnly = false;
	
	/**
	 * Set the read only
	 *
	 * @param boolean $readOnly
	 */
	function setReadOnly($readOnly = true) {
		$this->_isReadOnly = $readOnly;
	}
	
	/**
	 * Set the content show only
	 *
	 * @param boolean $contentOnly
	 */
	function setContentOnly($contentOnly = true) {
		$this->_isContentOnly = $contentOnly;
	}
	
	/**
	 * Function for geting the html for inputing data
	 *
	 * @abstract 
	 * @return string
	 */
	function getHtmlInputData($dataType = '', $extAttribute = '') {
		$extAttribute .= $this->buildValidateHtmlAttribute($dataType);
		if ($this->_isContentOnly) {
			return $this->buildHtmlPreviewData($extAttribute, null, $dataType);
		}
		if ($this->_isReadOnly) {
			$readOnly = 'readonly="readonly"';
		}
		$value = htmlspecialchars($this->_value);
		$inputHtml = "<input {$readOnly} {$extAttribute} name=\"{$this->_fieldName}\" id=\"{$this->_fieldName}\" value=\"{$value}\" />";
		return $inputHtml;
	}
}
?>
